<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>TravelDream</title>
	<link rel="stylesheet" type="text/css" href="../style/prodottobase.css" />
</h:head>
<h:body>
<div id="main">
		<div id="upper">
			<div id="logo"><a href="/TravelDreamWeb/home.jsf"><img id="logo-img" src="../img/logo.png"/></a></div>
			<div id="login-up">Benvenuto, #{utenteBean.name} <br />
				<h:form><p:commandButton action="#{logoutBean.logout()}" value="Logout" />
				<h:link outcome="PaginaDatiPersonali" value="Modifica dati personali" /></h:form>
			</div>
		</div>
		<div id="center">
		<div id="center1">
			<p:outputLabel>Crea un nuovo pacchetto viaggio:</p:outputLabel>
			<h:form id="pacchettoViaggio" >
				<p:panelGrid columns="6" id="pacchettoGrid" styleClass="noBorders">
				
					<h:outputLabel for="nome">Nome:</h:outputLabel>
					<p:inputText id="nome" value="#{pacchettoViaggioBean.getPacchetto().nome}"  required="true" requiredMessage="Campo obbligatorio!" />
					<h:outputText value=" " />
					<p:message for="nome" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="destinazione">Destinazione:</h:outputLabel>
					<p:inputText id="destinazione" value="#{pacchettoViaggioBean.getPacchetto().destinazione}" required="true" requiredMessage="Campo obbligatorio!" />
					<h:outputText value=" " />
					<p:message for="destinazione" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="data">Data validità: dal </h:outputLabel>
					<p:calendar id="data" value="#{pacchettoViaggioBean.getPacchetto().dataInizio}"  effect="drop" mindate="#{dataBean.getDataMin()}"  
					 	navigator="true" required="true" requiredMessage="Campo obbligatorio!"/>
					<h:outputLabel for="data2"> al </h:outputLabel>
					<p:calendar id="data2" value="#{pacchettoViaggioBean.getPacchetto().dataFine}" effect="drop" mindate="#{dataBean.getDataMin()}"  
						navigator="true" required="true" requiredMessage="Campo obbligatorio!"/>
					<p:message for="data"/>
					<p:message for="data2"/>
				
					<h:outputLabel for="data3">Data partenza proposta: </h:outputLabel>
					<p:calendar id="data3" value="#{pacchettoViaggioBean.getPacchetto().dataPartenza}"  effect="drop" mindate="#{dataBean.getDataMin()}"  
					 	navigator="true" required="true" requiredMessage="Campo obbligatorio!"/>
					<h:outputText value=" " />
					<p:message for="data3"/>
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="data4">Data ritorno proposta: </h:outputLabel>
					<p:calendar id="data4" value="#{pacchettoViaggioBean.getPacchetto().dataRitorno}"  effect="drop" mindate="#{dataBean.getDataMin()}"  
						navigator="true" required="true" requiredMessage="Campo obbligatorio!"/>
					<h:outputText value=" " />
					<p:message for="data4"/>
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="numeroPersone">Numero di persone:</h:outputLabel>
					<p:inputText id="numeroPersone" value="#{pacchettoViaggioBean.getPacchetto().numeroPersone}" required="true" requiredMessage="Campo obbligatorio!" />
					<h:outputText value=" " />
					<p:message for="numeroPersone" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="prezzo">Prezzo(€/giorno):</h:outputLabel>
					<p:inputText id="prezzo" value="#{pacchettoViaggioBean.getPacchetto().prezzo}" required="true" requiredMessage="Campo obbligatorio!" />
					<h:outputText value=" " />
					<p:message for="prezzo" />
					<h:outputText value=" " />
					<h:outputText value=" " />
			
					<h:outputLabel for="voloAnd">Volo di andata:</h:outputLabel> 
        			<p:selectOneMenu id="voloAnd" value="#{pacchettoViaggioBean.pacchetto.voloAndata}" converter="#{converterBean}" panelStyle="width:400px"  
                		effect="fade" var="v" style="width:160px"  filter="true" filterMatchMode="startsWith" required="true" requiredMessage="Campo obbligatorio!">  
            			<f:selectItem itemLabel="Seleziona" itemValue="" />  
            			<f:selectItems value="#{voloBean.listaVoliDTO}" var="volo" itemLabel="#{volo.compagnia}" itemValue="#{volo}"/>
            			<p:column>  
                			<p:outputLabel value="#{v.compagnia}" />  
            			</p:column>  
  						<p:column>  
                			#{v.aeroportoPartenza} - #{v.aeroportoArrivo}  
            			</p:column>  
            			<p:column>  
                			<p:outputLabel value="#{v.codiceVolo}" />
            			</p:column>  
        			</p:selectOneMenu>   
					<h:outputText value=" " />
					<p:message for="voloAnd" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="voloRit">Volo di ritorno:</h:outputLabel> 
        			<p:selectOneMenu id="voloRit" value="#{pacchettoViaggioBean.pacchetto.voloRitorno}" converter="#{converterBean}" panelStyle="width:400px"  
                		effect="fade" var="v" style="width:160px"  filter="true" filterMatchMode="startsWith" required="true" requiredMessage="Campo obbligatorio!">  
            			<f:selectItem itemLabel="Seleziona" itemValue="" />  
            			<f:selectItems value="#{voloBean.listaVoliDTO}" var="volo" itemLabel="#{volo.compagnia}" itemValue="#{volo}"/>
            			<p:column>  
                			<p:outputLabel value="#{v.compagnia}" />  
            			</p:column>  
  						<p:column>  
                			#{v.aeroportoPartenza} - #{v.aeroportoArrivo}  
            			</p:column>  
            			<p:column>  
                			<p:outputLabel value="#{v.codiceVolo}" />
            			</p:column>  
        			</p:selectOneMenu>   
					<h:outputText value=" " />
					<p:message for="voloRit" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="hotelP">Hotel:</h:outputLabel> 
        			<p:selectOneMenu id="hotelP" value="#{pacchettoViaggioBean.pacchetto.hotel}" converter="#{converterBean}" panelStyle="width:400px"  
                		effect="fade" var="h" style="width:160px"  filter="true" filterMatchMode="startsWith" required="true" requiredMessage="Campo obbligatorio!">  
            			<f:selectItem itemLabel="Seleziona" itemValue="" />  
            			<f:selectItems value="#{hotelBean.listaHotelDTO}" var="hotel" itemLabel="#{hotel.nome}" itemValue="#{hotel}"/>
            			<p:column>  
                			<p:outputLabel value="#{h.nome}" />  
            			</p:column>  
  						<p:column>  
                			numero stelle: #{h.numeroStelle}
            			</p:column>  
            			<p:column>  
                			<p:outputLabel value="#{h.prezzo} €" > </p:outputLabel>
            			</p:column>  
        			</p:selectOneMenu>   
					<h:outputText value=" " />
					<p:message for="hotelP" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="esc">Escursione:</h:outputLabel> 
        			<p:selectOneMenu id="esc" value="#{pacchettoViaggioBean.pacchetto.escursione}" converter="#{converterBean}" panelStyle="width:400px"  
                		effect="fade" var="e" style="width:160px"  filter="true" filterMatchMode="startsWith" required="true" requiredMessage="Campo obbligatorio!">  
            			<f:selectItem itemLabel="Seleziona" itemValue="" />  
            			<f:selectItems value="#{escursioneBean.listaEscursioniDTO}" var="escursione" itemLabel="#{escursione.nome}" itemValue="#{escursione}"/>
            			<p:column>  
                			<p:outputLabel value="#{e.nome}" />  
            			</p:column> 
            			<p:column>  
                			<p:outputLabel value="#{e.data}" > </p:outputLabel>
            			</p:column>  
        			</p:selectOneMenu>   
					<h:outputText value=" " />
					<p:message for="esc" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				</p:panelGrid>
				<p:panelGrid columns="6" styleClass="noBorders">
					<h:outputLabel for="alternativeHotel">Alternative hotel:</h:outputLabel>
					<p:selectManyMenu id="alternativeHotel" value="#{pacchettoViaggioBean.getPacchetto().alternativeHotel}" converter="#{converterBean}" style="width:600px;height:120px" 
						var="h" showCheckbox="true">  
            			<f:selectItems value="#{hotelBean.listaHotelDTO}" var="hotel" itemLabel="#{hotel.nome}" itemValue="#{hotel}" />  
            			<p:column>  
                			#{h.nome}  
            			</p:column>
        			</p:selectManyMenu>  
        			<h:outputText value="" />
					<h:outputText value="" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<h:outputLabel for="alternativeEsc">Alternative escursione:</h:outputLabel>
					<p:selectManyMenu id="alternativeEsc" value="#{pacchettoViaggioBean.getPacchetto().alternativeEsc}" converter="#{converterBean}" style="width:600px;height:120px" 
						var="e" showCheckbox="true">  
            			<f:selectItems value="#{escursioneBean.listaEscursioniDTO}" var="escursione" itemLabel="#{escursione.nome}" itemValue="#{escursione}" />  
            			<p:column>  
                			#{e.nome}  
            			</p:column>
            			<p:column>  
                			<p:outputLabel value="#{e.data}" > </p:outputLabel>
            			</p:column> 
        			</p:selectManyMenu>  
        			<h:outputText value="" />
					<h:outputText value="" />
					<h:outputText value=" " />
					<h:outputText value=" " />
				
					<p:commandButton value="Crea" update="pacchettoViaggio"
						action="#{pacchettoViaggioBean.aggiungi()}" />
				</p:panelGrid>
			</h:form>
			</div></div>
			<div id="footer">
				<h:link outcome="PaginaPrincipale" value="Torna alla pagina principale" />
			</div>
		</div>
</h:body>
</html>